diff --git a/src/www/ui/showjobs.php b/src/www/ui/showjobs.php index f39bd63d..5e900135 100644 --- a/src/www/ui/showjobs.php +++ b/src/www/ui/showjobs.php @@ -1,235 +1,231 @@ Name = "showjobs"; $this->Title = TITLE_showjobs; $this->MenuOrder = 5; $this->Dependency = array("browse"); $this->DBaccess = PLUGIN_DB_WRITE; global $container; $this->showJobsDao = $container->get('dao.show_jobs'); $this->uploadDao = $container->get('dao.upload'); parent::__construct(); } function RegisterMenus() { menu_insert("Main::Jobs::My Recent Jobs",$this->MenuOrder -1,$this->Name, $this->MenuTarget); if ($_SESSION[Auth::USER_LEVEL] != PLUGIN_DB_ADMIN) return; if (GetParm("mod", PARM_STRING) == $this->Name){ /* Set micro menu to select either all users or this user */ $allusers = GetParm("allusers",PARM_INTEGER); if ($allusers == 0){ $text = _("Show uploads from all users"); $URI = $this->Name . Traceback_parm_keep(array( "page" )) . "&allusers=1"; }else{ $text = _("Show only your own uploads"); $URI = $this->Name . Traceback_parm_keep(array( "page")) . "&allusers=0"; } menu_insert("showjobs::$text", 1, $URI, $text); } } // RegisterMenus() /** * @brief Returns geeky scan details about the jobqueue item * @param $job_pk * @return Return job and jobqueue record data in an html table. **/ function showJobDB($job_pk) { global $container; /** @var DbManager */ $dbManager = $container->get('db.manager'); $statementName = __METHOD__."ShowJobDBforjob"; $dbManager->prepare($statementName, - "SELECT *, jq_endtime-jq_starttime as elapsed FROM jobqueue LEFT JOIN job ON job.job_pk = jobqueue.jq_job_fk WHERE jobqueue.jq_pk = $1"); + "SELECT *, jq_endtime-jq_starttime as elapsed FROM jobqueue LEFT JOIN job ON job.job_pk = jobqueue.jq_job_fk WHERE jobqueue.jq_pk = $1"); $result = $dbManager->execute($statementName, array($job_pk)); $row = $dbManager->fetchArray($result); $dbManager->freeResult($result); if (!empty($row["job_upload_fk"])){ /* get the upload filename */ $statementName = __METHOD__."upload_filenameforShowJobDB"; - $dbManager->prepare($statementName, - "select upload_filename, upload_desc from upload where upload_pk =$1"); + $dbManager->prepare($statementName, "select upload_filename from upload where upload_pk =$1"); $uploadresult = $dbManager->execute($statementName, array($row['job_upload_fk'])); $uploadRow = $dbManager->fetchArray($uploadresult); if (empty($uploadRow)){ /* upload has been deleted so try to get the job name from the original upload job record */ $jobName = $this->showJobsDao->getJobName($row["job_upload_fk"]); $upload_filename = "Deleted " . $jobName; - $upload_desc = ''; }else{ $upload_filename = $uploadRow['upload_filename']; - $upload_desc = $uploadRow['upload_desc']; } $dbManager->freeResult($uploadresult); if (empty($row['jq_pk'])){ return _("Job history record is no longer available"); } $uploadtree_tablename = $this->uploadDao->getUploadtreeTableName($row['job_upload_fk']); /* Find the uploadtree_pk for this upload so that it can be used in the browse link */ $statementName = __METHOD__."uploadtreeRec"; $uploadtreeRec = $dbManager->getSingleRow( - "select * from $uploadtree_tablename where parent is NULL and upload_fk=$1", - array($row['job_upload_fk']), - $statementName - ); + "select * from $uploadtree_tablename where parent is NULL and upload_fk=$1", + array($row['job_upload_fk']), + $statementName); $uploadtree_pk = $uploadtreeRec['uploadtree_pk']; } /* upload file name link to browse */ if (!empty($row['job_upload_fk'])){ - $uploadTreeName = ""; $uploadTreeName = "" . $upload_filename . ""; return $uploadTreeName; } } // showJobDB() public function Output() { $page = ""; $uploadPk = GetParm('upload',PARM_INTEGER); if (empty($uploadPk)){ $uploadPk = -1; } elseif($uploadPk>0){ if (!$this->uploadDao->isEditable($uploadPk, Auth::getGroupId())){ $text = _("Permission Denied"); return "